home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / postscript.798 < prev    next >
Text File  |  1992-02-06  |  1KB  |  47 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f3\fmodern Ohlfs;\f1\fswiss Helvetica;}
  2. \paperw13040
  3. \paperh10800
  4. \margl120
  5. \margr120
  6. {\colortbl\red0\green0\blue0;}
  7. \pard\tx1140\tx2300\tx3440\tx4600\tx5760\tx6900\tx8060\tx9200\tx10360\tx11520\f0\b0\i0\ul0\fs28\fc0 sending PostScript to the WindowServer\
  8.  
  9. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600 \
  10. Q:  How can I send a PostScript file directly to the 
  11. \fc0 WindowServer
  12. ?\
  13. \
  14. A: You should usually use NXImage.  However, if that's not appropriate in your situation use the following code snippet.  
  15. Warning: Do 
  16. \b not
  17. \b0  use 
  18. \b PSRun()
  19. \b0 !\
  20. \
  21.  
  22. \pard\tx620\tx1240\tx1860\tx2480\tx3100\tx3720\tx4340\tx4980\tx5600\tx6220\f3\fs22\fc0     int SendFileToPS(const char *fileName)\
  23.     \{\
  24.         NXStream *st;\
  25.         char *addr;\
  26.         int len, maxlen;\
  27. \
  28.         st = NXMapFile(fileName, NX_READONLY);\
  29.         if (st) \{\
  30.             NXGetMemoryBuffer(st, &addr, &len, &maxlen);\
  31.             DPSWriteData(DPSGetCurrentContext(), addr, len);\
  32.             NXCloseMemory(st, NX_FREEBUFFER);\
  33.             return 0;\
  34.         \} else\
  35.             return -1;\
  36.     \}\
  37.  
  38. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\fs28 \
  39.  
  40. \fc0 \
  41. QA798\
  42. \
  43. Valid for 1.0\
  44. Valid for 2.0\
  45. \
  46.  
  47.